from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

# API路由器
router = DefaultRouter()
router.register(r'analytics', views.AnalyticsViewSet, basename='analytics')

app_name = 'analytics'

urlpatterns = [
    # Web视图
    path('', views.analytics_dashboard, name='dashboard'),
    path('dashboard/', views.analytics_dashboard, name='dashboard_alt'),
    path('logs/', views.log_viewer, name='log_viewer'),
    path('file-logs/', views.file_log_viewer, name='file_log_viewer'),
    
    # AJAX接口
    path('ajax/dashboard/', views.ajax_dashboard_data, name='ajax_dashboard_data'),
    path('ajax/dashboard-data/', views.ajax_dashboard_data, name='ajax_dashboard_data_alt'),
    path('ajax/logs/', views.ajax_log_data, name='ajax_log_data'),
    path('ajax/log_data/', views.ajax_log_data, name='ajax_log_data'),
    
    # API路由
    path('api/', include(router.urls)),
]